<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  User: zhouyanchao
  Date: 2017/10/27
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" %>


<div class="am-u-sm-12">
	<ul class="am-pagination">
		<li class="am-pagination-prev"><a href="javascript:void(0);" onclick="preMonth(${monthBean.year},${monthBean.month});">&laquo; 上月</a></li>
		<li><span>${monthBean.year}年${monthBean.month}月</span></li>
		<li class="am-pagination-next"><a href="javascript:void(0);" onclick="nextMonth(${monthBean.year},${monthBean.month});">下月 &raquo;</a></li>
	</ul>
</div>
<div class="am-u-sm-12">
	<table class="am-table am-table-bordered am-text-center">
		<thead>
		<tr>
			<td>周日</td>
			<td>周一</td>
			<td>周二</td>
			<td>周三</td>
			<td>周四</td>
			<td>周五</td>
			<td>周六</td>
		</tr>
		</thead>
		<tbody>

			<c:forEach items="${monthBean.days}" var="day" varStatus="i">

				<c:if test="${i.first || (i.count+monthBean.firstDayWeek)%7==1}">
					<tr>
				</c:if>
				<%--空格--%>
				<c:if test="${i.first && monthBean.firstDayWeek<7}">
					<c:forEach begin="1" end="${monthBean.firstDayWeek}">
						<td></td>
					</c:forEach>
				</c:if>


				<%--不可操作日期--%>
				<c:if test="${!day.operate}">
					<%--有课程--%>
					<c:if test="${day.classes}">
						<td class="daytd passed schedued" dateStr="${day.dayStr}">${day.day}</td>
					</c:if>
					<%--没有课程--%>
					<c:if test="${!day.classes}">
						<td class="daytd passed" dateStr="${day.dayStr}">${day.day}</td>
					</c:if>

				</c:if>

				<c:if test="${day.operate}">
					<%--有课程--%>
					<c:if test="${day.classes}">
						<td class="daytd unpassed schedued" dateStr="${day.dayStr}">${day.day}</td>
					</c:if>
					<%--没有课程--%>
					<c:if test="${!day.classes}">
						<td class="daytd unpassed" dateStr="${day.dayStr}">${day.day}</td>
					</c:if>
				</c:if>

				<%--补末尾空格--%>
				<c:if test="${i.last && (monthBean.firstDayWeek+i.count)%7>0}">
					<c:forEach begin="1" end="${7-(monthBean.firstDayWeek+i.count)%7}">
						<td>-</td>
					</c:forEach>
				</c:if>

				<c:if test="${i.last ||(i.count+monthBean.firstDayWeek)%7==0}">
					</tr>
				</c:if>

			</c:forEach>

		</tbody>

	</table>
	<table>
		<tr>
			<td style="background-color: lightgrey;">不可操作日期</td>
			<td style="background-color: yellow;">已过期的课程</td>
			<td style="background-color: greenyellow;">已安排的课程</td>
		</tr>
	</table>
</div>

